export default class Queue {
  #value = []

  constructor(initialValue) {
    if (initialValue instanceof Array) {
      this.#value = initialValue
    }
  }

  enqueue(...args) {
    this.#value = this.#value.concat(args)
  }

  dequeue() {
    return this.#value.shift()
  }

  front() {
    return this.#value[0]
  }

  isEmpty() {
    return this.#value.length === 0
  }

  get size() {
    return this.#value.length
  }

  toString() {
    return this.#value
  }

  join(separator) {
    return this.#value.join(separator)
  }

  generate() {
    return new Queue([...this.#value])
  }
}